package com.genexususa.eo.connection.google.main;

import com.genexususa.eo.connection.google.analytics.AnalyticsManager;

public class getTop10Keywords {

    public static void main(String[] args){

        try{

            String xml = "<GoogleAnalyticsQuery xmlns=\"L2TMediaTrunk\">\n" +
                    "                <filePath/>\n" +
                    "                <applicationName>aaa</applicationName>\n" +
                    "                <profileId>123</profileId>\n" +
                    "                <startDate>2014-1-18</startDate>\n" +
                    "                <endDate>2014-1-20</endDate>\n" +
                    "                <applicationId/>\n" +
                    "                <Query>GA</Query>\n" +
                    "                <AnalyticsImportId>8</AnalyticsImportId>\n" +
                    "                <metrics>\n" +
                    "                               <Item>ga:visits</Item>\n" +
                    "                               <Item>ga:visitors</Item>\n" +
                    "                               <Item>ga:pageviews</Item>\n" +
                    "                               <Item>ga:timeOnSite</Item>\n" +
                    "                               <Item>ga:newVisits</Item>\n" +
                    "                               <Item>ga:bounces</Item>\n" +
                    "                </metrics>\n" +
                    "                <dimensions>\n" +
                    "                               <Item>ga:keyword</Item>\n" +
                    "                </dimensions>\n" +
                    "                <filters>\n" +
                    "                               <Item>ga:medium==organic</Item>\n" +
                    "                </filters>\n" +
                    "                <maxResults>0</maxResults>\n" +
                    "</GoogleAnalyticsQuery>\n";

            xml = "<GoogleAnalyticsQuery xmlns=\"L2TMedia1.5\">\n" +
                    "\t<filePath>C:\\L2T\\nbov</filePath>\n" +
                    "\t<applicationName>L2TMEDIA</applicationName>\n" +
                    "\t<profileId>12785198</profileId>\n" +
                    "\t<accountId>12785198</accountId>\n" +
                    "\t<startDate>2014-01-01</startDate>\n" +
                    "\t<Query>GA</Query>\n" +
                    "\t<AnalyticsImportId>1</AnalyticsImportId>\n" +
                    "\t<endDate>2014-08-30</endDate>\n" +
                    "\t<metrics>\n" +
                    "\t\t<Item>ga:visits</Item>\n" +
                    "\t</metrics>\n" +
                    "\t<dimensions>\n" +
                    "\t\t<Item>ga:keyword</Item>\n" +
                    "\t</dimensions>\n" +
                    "\t<filters>\n" +
                    "\t\t<Item>ga:medium==organic</Item>\n" +
                    "\t\t<Item>ga:keyword!=(not provided)</Item>\n" +
                    "\t\t<Item>ga:keyword!=GeneXusUSA</Item>\n" +
                    "\t</filters>\n" +
                    "\t<maxResults>0</maxResults>\n" +
                    "</GoogleAnalyticsQuery>";


            xml = "\n" +
                    "<GoogleAnalyticsQuery xmlns=\"L2TMediaTrunk\">\n" +
                    "        <filePath>c:\\l2t\\gm</filePath>\n" +
                    "        <applicationName>L2TMEDIA</applicationName>\n" +
                    "        <profileId>26486741</profileId>\n" +
                    "        <startDate>2014-11-01</startDate>\n" +
                    "        <endDate>2014-11-30</endDate>\n" +
                    "        <accountId/>\n" +
                    "        <Query/>\n" +
                    "        <metrics>\n" +
                    "                <Item>ga:visits</Item>\n" +
                    "                <Item>ga:visitors</Item>\n" +
                    "                <Item>ga:pageviews</Item>\n" +
                    "                <Item>ga:timeOnSite</Item>\n" +
                   // "                <Item>ga:sessionDuration</Item>\n" +
                    "                <Item>ga:newVisits</Item>\n" +
                    "                <Item>ga:bounces</Item>\n" +
                    "        </metrics>\n" +
                    //"        <dimensions>\n" +
                    //"                <Item>ga:keyword</Item>\n" +
                    //"        </dimensions>\n" +
                   // "        <filters>\n" +
                    //"                <Item>ga:medium==organic</Item>\n" +
                    //"                <Item>ga:keyword==(not set)</Item>\n" +
                   // "        </filters>\n" +
                    "        <segments>\n" +
                    "                <Item>gaid::-5</Item>\n" +
                    "        </segments>\n" +
                    "        <maxResults>0</maxResults>\n" +
                    "</GoogleAnalyticsQuery>\n";
//segment=gaid::-10
            AnalyticsManager am = new AnalyticsManager();
            String res = am.getTop10Keywords(xml);
            System.out.println(res);




        System.out.println("");
        }catch (Exception e){
            e.printStackTrace();
        }


    }
}
